
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class RegisterInterface extends JFrame{
    public RegisterInterface(){
        init();
    }

    Box vBox =Box.createVerticalBox();

    public void init()  {

        this.setTitle("注册界面");

        JPanel contentPane = new JPanel();
        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
        contentPane.setLayout(new BorderLayout(0, 0));


        JLayeredPane layeredPane = new JLayeredPane();
        contentPane.add(layeredPane, BorderLayout.CENTER);

        this.add(contentPane);

        // 用户名
        JLabel uLabel = new JLabel("用户名：");
        uLabel.setBounds(80, 80, 70, 18);
        layeredPane.add(uLabel);

        JTextField uField = new JTextField();
        uField.setBounds(140, 81, 176, 19);
        layeredPane.add(uField);

        // 密码
        JLabel pLabel = new JLabel("密    码：");
        pLabel.setBounds(80, 120, 72, 18);
        layeredPane.add(pLabel);

        JTextField pField = new JTextField();
        pField.setBounds(140, 121, 176, 19);
        layeredPane.add(pField);

        // 手机号
        JLabel tLabel = new JLabel("手机号：");
        tLabel.setBounds(80, 160, 72, 18);
        layeredPane.add(tLabel);

        JTextField tField = new JTextField();
        tField.setBounds(140, 161, 176, 19);
        layeredPane.add(tField);

        // 性别
        JLabel gLabel = new JLabel("性   别：");
        gLabel.setBounds(80, 200, 72, 18);
        layeredPane.add(gLabel);

        JRadioButton maleBtn = new JRadioButton("男", true);
        maleBtn.setBounds(140, 201, 60, 19);
        layeredPane.add(maleBtn);

        JRadioButton femaleBtn = new JRadioButton("女", false);
        femaleBtn.setBounds(210, 201, 60, 19);
        layeredPane.add(femaleBtn);

        // 注册按钮
        JButton regisBtn = new JButton("注册");
        regisBtn.setBounds(80, 241, 72, 23);
        layeredPane.add(regisBtn);

        // 返回登录页面
        JButton backBtn = new JButton("返回登录页面");
        backBtn.setBounds(200, 241, 120, 23);
        layeredPane.add(backBtn);

        backBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                LoginFrameWindow loginFrameWindow =new LoginFrameWindow();
                loginFrameWindow.setVisible(true);
            }
        });

        this.setVisible(true);
        this.setSize(500,500);

        this.setLocationRelativeTo(null);
    }

    public static void main(String[] args) {
        new RegisterInterface();
    }
}

